//
//  YZLCarRedioListCell.m
//  Car
//
//  Created by dllo on 15/11/5.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZLCarRedioListCell.h"

@interface YZLCarRedioListCell ()

@property (nonatomic, strong) UILabel *joinLabel;
@property (nonatomic, strong) UILabel *timeLengthLabel;
@property (nonatomic, strong) UIImageView *leftImage;
@property (nonatomic, strong) UIImageView *rightImage;

@end

@implementation YZLCarRedioListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.timeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.timeLabel];
        
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.titleLabel];
        
        self.joinLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.joinLabel];
        self.joinLabel.textColor = [UIColor lightGrayColor];
        self.joinLabel.font = [UIFont systemFontOfSize:15];
        
        self.timeLengthLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.timeLengthLabel];
        self.timeLengthLabel.textColor = [UIColor lightGrayColor];
        self.timeLengthLabel.font = [UIFont systemFontOfSize:15];
        
        self.leftImage = [[UIImageView alloc] init];
        self.leftImage.image = [UIImage imageNamed:@"听"];
        [self.contentView addSubview:self.leftImage];
        
        self.rightImage = [[UIImageView alloc] init];
        self.rightImage.image = [UIImage imageNamed:@"时间"];
        [self.contentView addSubview:self.rightImage];
        
        self.playImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.playImage];
        
        }
    
    return self;
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    self.timeLabel.frame = CGRectMake(15, 5, 100, 20);
    self.titleLabel.frame = CGRectMake(110, 5, self.contentView.frame.size.width - 120, 20);
    self.joinLabel.frame = CGRectMake(55, 30, 50, 20);
    self.timeLengthLabel.frame = CGRectMake(self.contentView.frame.size.width - 155, 30, 80, 20);
    self.leftImage.frame = CGRectMake(30, 30, 20, 20);
    self.rightImage.frame = CGRectMake(self.contentView.frame.size.width - 180, 30, 20, 20);
    self.playImage.frame = CGRectMake(self.contentView.frame.size.width - 40, 15, 25, 25);
}

- (void)setModel:(YZLCarRedioListModel *)model {
   
    if (_model != model) {
        _model = model;
    }
    
    self.timeLabel.text = self.model.program_live_time;
    self.titleLabel.text = self.model.program_title;
    self.joinLabel.text = [NSString stringWithFormat:@"%@", self.model.program_join_num];
    self.timeLengthLabel.text = self.model.program_time_length;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
